package com.sisyphus.tron.persistence;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

@Entity(tableName = "tron_account")
public class AccountEntity {


    @NonNull
    @ColumnInfo(name = "alias")
    private String alias; // 别名

    @NonNull
    @ColumnInfo(name = "public_key")
    private String publicKey; // 公钥

    @NonNull
    @ColumnInfo(name = "private_key")
    private String privateKey; // 私钥

    @NonNull
    @PrimaryKey
    @ColumnInfo(name = "address")
    private String address; // 地址

    @NonNull
    @ColumnInfo(name = "password")
    private String password; // 密码

    public AccountEntity() {
        // room use
    }

    @Ignore
    public AccountEntity(@NonNull String address) {
        this.address = address;
    }

    @Ignore
    public AccountEntity(@NonNull String address, @NonNull String password) {
        this.address = address;
        this.password = password;
    }


    @Ignore
    public AccountEntity(
            @NonNull String publicKey,
            @NonNull String privateKey,
            @NonNull String address,
            @NonNull String password,
            @NonNull String alias) {

        this.publicKey = publicKey;
        this.privateKey = privateKey;
        this.address = address;
        this.password = password;
        this.alias = alias;
    }


    public void setAlias(@NonNull String alias) {
        this.alias = alias;
    }

    @NonNull
    public String getAlias() {
        return alias;
    }

    @NonNull
    public String getAddress() {
        return address;
    }

    public void setAddress(@NonNull String address) {
        this.address = address;
    }

    @NonNull
    public String getPassword() {
        return password;
    }

    public void setPassword(@NonNull String password) {
        this.password = password;
    }

    @NonNull
    public String getPublicKey() {
        return publicKey;
    }

    public void setPublicKey(@NonNull String publicKey) {
        this.publicKey = publicKey;
    }

    @NonNull
    public String getPrivateKey() {
        return privateKey;
    }

    public void setPrivateKey(@NonNull String privateKey) {
        this.privateKey = privateKey;
    }

}
